<?php

namespace common\models;

use Yii;
use yii\base\Model;

class ForgetPasswordForm extends Model
{
    public $mobile;
    //public $verifyCode;
    public $pwd;
    public $mobileCode;
    public $rePwd;
	public $is_allowed;					//第一次登陆勾选注册条款

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['mobile', 'pwd', 'mobileCode','rePwd'], 'required','on' => ['default']],
            [['mobile', 'pwd'], 'required','on' => ['backend']],
            ['mobile', 'trim'],
			[['is_allowed'], 'safe'],
            ['pwd', 'string', 'min' => 6,'message'=>'密码长度必须大于6位'],
            ['pwd', 'string', 'max'=>16,'message'=>'密码长度必须小于16位'],
            ['rePwd', 'compare', 'compareAttribute' => 'pwd','message'=>'两次输入的密码不一致！'],
        ];
    }

    public function scenarios()
    {
        return [
            'default' => ['mobile', 'pwd', 'mobileCode','is_allowed','rePwd'],
            'backend' => ['mobile', 'pwd'],
        ];
    }
}
